package com.baidu.user.controller;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baidu.pojo.App;
import com.baidu.pojo.Cart;
import com.baidu.pojo.CartItem;
import com.baidu.user.service.DataMongoService;

@Controller
public class DataMongoController {
	
		@Autowired
		private DataMongoService service;
		
		@RequestMapping("dataMongo")
		public void dataMongo(String appsku,HttpServletRequest request){
			service.getAppSku(appsku,request);
		}
		
		
		@RequestMapping("orderjsp")
		public String  orderjsp(HttpServletRequest request){
			Cart cart =service.getCartList(request);
			List<CartItem> list = cart.getItems();
			request.getSession().setAttribute("list", list);
			return "order";
		}
		@RequestMapping("toadd")
		public void  toadd(HttpServletRequest request){
			 service.doAddApp(request);
		}
		
		@RequestMapping("del")
		public void  del(String id){
			 service.dodelApp(id);
		}
		
		
}
